package com.base.myproject.client.busi.BO;


import java.io.Serializable;
import java.util.Map;

import com.extjs.gxt.ui.client.data.BaseModelData;


/**
 * 此类可以看作是一切需要与服务器通讯的父类。
 * 在子类里面要覆盖 save，update，delete 这些方法；
 * @author zgw
 *2009-8-27 下午07:24:51
 * javazgw@gmail.com
 */
public class BaseObject extends BaseModelData implements Serializable,SetGetValue {


	/**
	 * 
	 */
	private static final long serialVersionUID = -137103471007019119L;
	/**
	 * 
	 * 
	 */
//	private static final long serialVersionUID = 10008987L;
//	public final static int NOTHING =1;
//	public final static int INSERT =2;
//	public final static int UPDATE =4;
//	public final static int DELETE =8;
//	//取消删除
//	public final static int CANCELDELETE = NOTHING+INSERT+UPDATE;
	int busistatus = 1;
	public BaseObject()
	{
		
	}
	  public BaseObject(Map<String, Object> properties) {
		    super(properties);
		 //   setProperties(properties);
		  }
	public String insert()
	{
		return null;
	}
	public String update()
	{
		return null;
	}
	public String delete()
	{
		return null;
	}

	/**
	 * @return the status
	 */
	public int getBusistatus() {
		return busistatus;
	}
	/**
	 * @param status the status to set
	 */
	public void setBusistatus(int status) {

		this.busistatus =this.busistatus | status;
	}
	/**
	 * 取出某个属性
	 * 比如去除 DELETE属性，那么就将原来的属性和 NOTHING+INSERT+UPDATE 做与运算
	 * @param status
	 */
	public void removeBusistatus(int status)
	{
		this.busistatus =this.busistatus & status;
	}
	public void clearBusistatus()
	{
		this.busistatus =NOTHING;
	}
	/**
	 * 重载父类，加入更新标识
	 */
	  public <X> X set(String property, X value) {
		  setBusistatus(UPDATE);
		  return  super.set(property, value);
		   
		  }
	  public <X> X setNotFlag(String property, X value) {
		  return  super.set(property, value);
	  }
}

